export function Mapa(ak) {
  return new Promise(function (resolve, reject) {
    try {
      console.log("BMap is defined:", BMapGL === undefined || BMapGL);
      resolve(BMapGL);
    } catch (err) {
      window.init = function () {
        resolve(BMapGL);
      };
      var script = document.createElement("script");
      script.type = "text/javascript";
      script.src = "//api.map.baidu.com/api?v=1.2.6&type=webgl&ak=" + ak + "&callback=init";

      script.onerror = reject;
      document.head.appendChild(script);
    }
  })
}
